Skip to content

Compact default CLI and MCP output#2

Closed
andrei-hasna wants to merge 1 commit into
mainfrom
fix/compact-cli-output
Closed

Compact default CLI and MCP output#2
andrei-hasna wants to merge 1 commit into
mainfrom
fix/compact-cli-output

Conversation

@andrei-hasna

Copy link
Copy Markdown
Contributor

Summary

  • Make noisy CLI list/status/search-style output compact by default with capped human row counts, truncation, pagination hints, and --verbose/--json detail paths.
  • Add compact defaults and explicit full-detail affordances to MCP list/search/status tools (brief: false, verbose: true, include_raw: true, or detail/get tools).
  • Add coverage for compact defaults, full JSON/detail behavior, MCP context caps preserving target logs, and compact issue payloads.
  • Document compact output defaults and detail flags in the README.

Compatibility notes

  • Existing --json / --format json list paths continue to return full records where possible.
  • logs health now prints a compact human summary by default; use logs health --json for the full health object.
  • MCP status tools now return compact objects by default; use verbose: true for the full previous status payloads.

Before / after

Worst noisy path: logs list --limit 1 with a long log message plus large metadata.

Before:

2026-06-24T04:44:35.167Z  ERROR  checkout-automation-worker-with-long-name  checkout failure repeated during browser automation with a nested payload that includes route history request traces serialized context window retry diagnostics and verbose environment metadata repeated repeated repeated repeated repeated repeated repeated repeated repeated repeated end {"request_id":"req-example-123","payload":"metadata metadata metadata ...","nested":{"context":"browser route state retry diagnostics ..."}}

1 log(s)

After:

2026-06-24T04:44:35  ERROR  checkout-automa...  checkout failure repeated during browser automation with a nested payload that includes route history request traces serialized context w...  id=pr-example-log-1 trace=pr-example-trac...

showing 1 log(s).
Use --verbose for full messages/metadata or --json for full records.

Full machine-readable output remains available:

logs list --limit 1 --json

Adversarial review reconciliation

A read-only adversarial reviewer focused on CLI compatibility, output ergonomics, and token bloat found several issues. Reconciled in this branch:

  • MCP log_context_from_id capped results now preserve the requested target log; brief: false returns full context unless a limit is explicit.
  • CLI event/test-report list rows keep full IDs for events get <event_id> and test-reports get <report_id> workflows.
  • MCP include_raw: true now forces raw/full event rows for search/watch instead of requiring brief: false too.
  • MCP list_issues compact output truncates long issue messages.
  • Explicit logs list --format compact remains footerless/line-oriented.
  • MCP tool descriptions now advertise verbose and capped context parameters.

Validation

  • bun test src/cli/compact-output.test.ts src/mcp/index.test.ts
  • bun test
  • bun run lint
  • bun run build
  • git diff --check

@andrei-hasna

Copy link
Copy Markdown
Contributor Author

Closing as obsolete — superseded by the storage refactor on main, not mergeable via rebase.

Why: This PR was cut from base 92c8d00 (pre-refactor). Since then main has been almost entirely rewritten: src/cli/index.ts (~863 lines changed) and src/mcp/index.ts (~1152 lines changed) were migrated from the old synchronous getDb() + searchLogs()/tailLogs()/searchEvents() data-access API to a unified async Store abstraction (LocalStore/ApiStore, routing local | self_hosted | cloud). This PR's diff edits code paths that no longer exist.

A rebase onto current main was attempted and produces semantic conflicts across every hunk in both files (e.g. sync tailLogs(getDb(), …) handlers vs async (opts) => await store.tailLogs(…)), not textual conflicts that can be mechanically resolved. Salvaging it would mean reimplementing the whole compact-output feature against the new async Store API — including adding offset/pagination support to the store list methods across LocalStore, ApiStore, and the cloud server store — which is fresh feature work, not a PR rebase.

Note: Compact/default-brief output is still valuable and is NOT yet on main (verified: zero compact/--verbose markers in main:src/cli/index.ts). It should be re-done as a new PR against the current Store-based CLI/MCP. The intent is already tracked by the fleet-wide 'compact CLI/MCP output' initiative (implementation subtasks are in flight in the hotfixes project).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant